//
//  QKShareLiveSheetManager.m
//  Cat
//
//  Created by lushitong on 2018/12/25.
//  Copyright © 2018年 lushitong. All rights reserved.
//

#import "QKShareLiveSheetManager.h"

static NSString * const QKShareAlertKey = @"QKShareAlertKey";
static NSString * const QKSearchAlertKey = @"QKSearchAlertKey";
static NSString * const QKInviteAlertKey = @"QKInviteAlertKey";
static NSString * const QKAnthoreAlertKey = @"QKAnthoreAlertKey";

@implementation QKShareLiveSheetManager


/**
 * 显示一个普通的无取消按钮的弹框
 * superView  : 自定义superView，传nil则添加到keywindow
 * customView : 要显示的view
 */
+ (void)showPlayListWithSuperView:(UIView *)superView
					   customView:(UIView *)customView{
	
	JKAlertView.alertView(nil, nil, JKAlertStyleActionSheet).setCustomSuperView(superView).setAutoAdjustHomeIndicator(NO).setCancelAction(JKAlertAction.action(nil, JKAlertActionStyleDefault, nil).setCustomView(^UIView *(JKAlertAction *action) {
		
		return [UIView new];
		
	})).setCustomActionSheetTitleView(YES, ^UIView *{
		
		return customView;
		
	}).setClearFullScreenBackgroundColor(NO).setDismissKey(QKShareAlertKey).show();
}

+ (void)dismissPlayList{
	[self dismissForKey:QKShareAlertKey];
}

+ (void)showSearchWithSuperView:(UIView *)superView
					 customView:(UIView *)customView {
	
	JKAlertView *alertView = JKAlertView.alertView(nil, nil, JKAlertStylePlain).setPlainCornerRadius(15).setDismissAllNoneffective(YES).setBackGroundView(^UIView *{
		// 自定义背景view
		return customView;
	}).setCustomPlainTitleView(YES, ^UIView *(JKAlertView *view){
		// 自定义titleView
		return customView;
	}).setDismissKey(QKSearchAlertKey).setCustomSuperView(superView);
	
	[self setCommonAnimationWithAlertView:alertView];
	
	alertView.show();
}

+ (void)dismissSearch {
	[self dismissForKey:QKSearchAlertKey];
}

+ (void)showInviteSuperView:(UIView *)superView
                 customView:(UIView *)customView {
    JKAlertView *alertView = JKAlertView.alertView(nil, nil, JKAlertStylePlain).setPlainCornerRadius(15).setDismissAllNoneffective(YES).setBackGroundView(^UIView *{
        // 自定义背景view
        return customView;
    }).setCustomPlainTitleView(YES, ^UIView *(JKAlertView *view){
        // 自定义titleView
        return customView;
    }).setDismissKey(QKInviteAlertKey).setCustomSuperView(superView);
    
    [self setCommonAnimationWithAlertView:alertView];
    
    alertView.show();
}

+ (void)dissMissInvite {
    [self dismissForKey:QKInviteAlertKey];
}

+ (void)showAnthorSuperView:(UIView *)superView
                 customView:(UIView *)customView {
    
    JKAlertView *jkAlertView = JKAlertView.alertView(nil, nil, JKAlertStylePlain).setPlainCornerRadius(15).setDismissAllNoneffective(YES).setBackGroundView(^UIView *{
        return customView;
    }).setCustomPlainTitleView(YES, ^UIView *(JKAlertView *view){
        return customView;
        
    }).setDismissKey(QKAnthoreAlertKey).setCustomSuperView(superView).setClickBlankDismiss(YES);
    
    [self setCommonAnimationWithAlertView:jkAlertView];
    jkAlertView.show();
    
}

+ (void)dissMissAnthoreInvite {
    [self dismissForKey:QKAnthoreAlertKey];
}
@end
